﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{

    public partial class VVAFARBEN
    {
        #region
        #endregion
        public void SetUpNewRow(ref DataRow dwReturn, DataRow dwInput = null)
        {

            switch (app.company)
            {
                case "FLT":
                    DataSet SResult = new DataSet();
                    SResult = QueryVAFARBEN(dwInput, 0);
                    dwReturn = SResult.Tables[0].Rows[0];
                    #region
                    dwReturn["VAFMANDANT"] = app.Mandant;
                    dwReturn["VAFKOLL"] = "OTHER";
                    dwReturn["VAFART"] = "FS07059                 ";
                    dwReturn["VAFFARBE"] = "HZ7005    ";
                    dwReturn["VAFLIEFERSG"] = " ";
                    dwReturn["VAFBEZ"] = "BLACK               ";
                    dwReturn["VAFFFARBE"] = "HZ7005    ";
                    dwReturn["VAFDESS"] = "          ";
                    dwReturn["VAFCOLORIT"] = "          ";
                    dwReturn["VAFBESCHICH"] = "          ";
                    dwReturn["VAFPKUNDNR"] = "00000000";
                    dwReturn["VAFPWERK"] = "   ";
                    dwReturn["VAFPABT"] = "   ";
                    dwReturn["VAFPART"] = "400216.NM.68.2      ";
                    dwReturn["VAFPVAR"] = "  ";
                    dwReturn["VAFPLART"] = "                    ";
                    dwReturn["VAFSPERRDAT"] = "0";
                    dwReturn["VAFKZZOLL2"] = " ";
                    dwReturn["VAFFARBGRP"] = " ";
                    dwReturn["VAFMUFAEH"] = " ";
                    dwReturn["VAFCOFAEH"] = " ";
                    dwReturn["VAFMINPR1"] = "0";
                    dwReturn["VAFMINPR2"] = "0";
                    dwReturn["VAFABVK"] = "N";
                    dwReturn["VAFSFERTKZ"] = " ";
                    dwReturn["VAFEAN"] = "0000000000000";
                    dwReturn["VAFPGROE"] = "       ";
                    dwReturn["VAFARTBEZ"] = "FS07059   ";
                    dwReturn["VAFZUSTAND"] = "    ";
                    dwReturn["VAFURCODE1"] = "    ";
                    dwReturn["VAFURCODE2"] = "    ";
                    dwReturn["VAFURCODE3"] = "    ";
                    dwReturn["VAFURCODE4"] = "    ";
                    dwReturn["VAFKZDUMCOL"] = " ";
                    dwReturn["VAFLASCHE"] = " ";
                    dwReturn["VAFPVARKZ"] = " ";
                    dwReturn["VAFSTANDARD"] = " ";
                    dwReturn["VAFEANLASCHE"] = "0000000000000";
                    dwReturn["VAFFILLER"] = "                               ";
                    dwReturn["VAFAENDZL"] = "0";
                    dwReturn["VAFAENDBEN"] = "        ";
                    dwReturn["VAFAENDDAT"] = "0";
                    dwReturn["VAFNEUBEN"] = "LINDA   ";
                    dwReturn["VAFNEUDAT"] = "20080418";

                    #endregion
                    break;
                case "YGR":
                case "AFS":
                case "TST":
                case "UBT":
                case "SXN":
                default:
                    #region=========
                    dwReturn["VAFMANDANT"] = app.Mandant;
                    dwReturn["VAFKOLL"] = "     ";
                    dwReturn["VAFART"] = "                        ";
                    dwReturn["VAFFARBE"] = "          ";
                    dwReturn["VAFLIEFERSG"] = " ";
                    dwReturn["VAFBEZ"] = "                    ";
                    dwReturn["VAFFFARBE"] = "          ";
                    dwReturn["VAFDESS"] = "          ";
                    dwReturn["VAFCOLORIT"] = "          ";
                    dwReturn["VAFBESCHICH"] = "          ";
                    dwReturn["VAFPKUNDNR"] = "00000000";
                    dwReturn["VAFPWERK"] = "   ";
                    dwReturn["VAFPABT"] = "   ";
                    dwReturn["VAFPART"] = "                    ";
                    dwReturn["VAFPVAR"] = "  ";
                    dwReturn["VAFPLART"] = "                    ";
                    dwReturn["VAFSPERRDAT"] = "0";
                    dwReturn["VAFKZZOLL2"] = " ";
                    dwReturn["VAFFARBGRP"] = " ";
                    dwReturn["VAFMUFAEH"] = " ";
                    dwReturn["VAFCOFAEH"] = " ";
                    dwReturn["VAFMINPR1"] = "0";
                    dwReturn["VAFMINPR2"] = "0";
                    dwReturn["VAFABVK"] = "N";
                    dwReturn["VAFSFERTKZ"] = " ";
                    dwReturn["VAFEAN"] = "0000000000000";
                    dwReturn["VAFPGROE"] = "       ";
                    dwReturn["VAFARTBEZ"] = "     ";
                    dwReturn["VAFZUSTAND"] = "    ";
                    dwReturn["VAFURCODE1"] = "    ";
                    dwReturn["VAFURCODE2"] = "    ";
                    dwReturn["VAFURCODE3"] = "    ";
                    dwReturn["VAFURCODE4"] = "    ";
                    dwReturn["VAFKZDUMCOL"] = " ";
                    dwReturn["VAFLASCHE"] = " ";
                    dwReturn["VAFPVARKZ"] = " ";
                    dwReturn["VAFSTANDARD"] = " ";
                    dwReturn["VAFEANLASCHE"] = "0000000000000";
                    dwReturn["VAFFILLER"] = "                               ";
                    dwReturn["VAFAENDZL"] = "0";
                    dwReturn["VAFAENDBEN"] = "        ";
                    dwReturn["VAFAENDDAT"] = "0";
                    dwReturn["VAFNEUBEN"] = "        ";
                    dwReturn["VAFNEUDAT"] = "0";
                    #endregion
                    break;
            }
            INTEXDBC.MapData(true, ref dwReturn, dwInput);
        }

        public DataRow Convert2VAFARBEN(DataRow dwInput, string ITXDBVERSION, bool IsConvert = false)
        {
            DataSet SResult = new DataSet();
            SResult = QueryVAFARBEN(dwInput, 0);
            DataRow dwReturn = null;
            if (SResult.Tables[0].Rows.Count > 0)
            {
                dwReturn = SResult.Tables[0].Rows[0];
            }
            else
            {
                dwReturn = SResult.Tables[0].NewRow();
            }
            switch (ITXDBVERSION)
            {
                case "YGR":
                case "AFS":
                case "TST":
                case "UBT":
                case "SXN":
                default:
                    #region=========
                    dwReturn["VAFMANDANT"] = app.Mandant;
                    dwReturn["VAFKOLL"] = "     ";
                    dwReturn["VAFART"] = "                        ";
                    dwReturn["VAFFARBE"] = "          ";
                    dwReturn["VAFLIEFERSG"] = " ";
                    dwReturn["VAFBEZ"] = "                    ";
                    dwReturn["VAFFFARBE"] = "          ";
                    dwReturn["VAFDESS"] = "          ";
                    dwReturn["VAFCOLORIT"] = "          ";
                    dwReturn["VAFBESCHICH"] = "          ";
                    dwReturn["VAFPKUNDNR"] = "00000000";
                    dwReturn["VAFPWERK"] = "   ";
                    dwReturn["VAFPABT"] = "   ";
                    dwReturn["VAFPART"] = "                    ";
                    dwReturn["VAFPVAR"] = "  ";
                    dwReturn["VAFPLART"] = "                    ";
                    dwReturn["VAFSPERRDAT"] = "0";
                    dwReturn["VAFKZZOLL2"] = " ";
                    dwReturn["VAFFARBGRP"] = " ";
                    dwReturn["VAFMUFAEH"] = " ";
                    dwReturn["VAFCOFAEH"] = " ";
                    dwReturn["VAFMINPR1"] = "0";
                    dwReturn["VAFMINPR2"] = "0";
                    dwReturn["VAFABVK"] = "N";
                    dwReturn["VAFSFERTKZ"] = " ";
                    dwReturn["VAFEAN"] = "0000000000000";
                    dwReturn["VAFPGROE"] = "       ";
                    dwReturn["VAFARTBEZ"] = "     ";
                    dwReturn["VAFZUSTAND"] = "    ";
                    dwReturn["VAFURCODE1"] = "    ";
                    dwReturn["VAFURCODE2"] = "    ";
                    dwReturn["VAFURCODE3"] = "    ";
                    dwReturn["VAFURCODE4"] = "    ";
                    dwReturn["VAFKZDUMCOL"] = " ";
                    dwReturn["VAFLASCHE"] = " ";
                    dwReturn["VAFPVARKZ"] = " ";
                    dwReturn["VAFSTANDARD"] = " ";
                    dwReturn["VAFEANLASCHE"] = "0000000000000";
                    dwReturn["VAFFILLER"] = "                               ";
                    dwReturn["VAFAENDZL"] = "0";
                    dwReturn["VAFAENDBEN"] = "        ";
                    dwReturn["VAFAENDDAT"] = "0";
                    dwReturn["VAFNEUBEN"] = "        ";
                    dwReturn["VAFNEUDAT"] = "0";
                    #endregion
                    break;
                case "JLT":

                    break;
            }
            INTEXDBC.MapData(IsConvert, ref dwReturn, dwInput);
            return dwReturn;
        }

        public void SaveVAFARBEN(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            DataSet setResult = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            setResult = QVAF02(dwData);
            if (setResult.Tables.Count > 0)
            {
                tbLocal = setResult.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                }
            }
            if (!flgExist)
            {
                InsertVAFARBEN(dwData, ITXDBVERSION);
            }
            switch (ITXDBVERSION)
            {
                case "YGR":
                case "AFS":
                case "TST":
                case "UBT":
                case "SXN":
                default:
                    UpdateVAFARBEN(dwData, ITXDBVERSION, 3);
                    break;
                case "JLT":
                    UpdateVAFARBEN(dwData, ITXDBVERSION, 1);
                    break;
            }

        }

        public void InsertVAFARBEN(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            dwData["VAFNEUBEN"] = app.User;
            dwData["VAFNEUDAT"] = date;
            or1 = OracleDB.CreateCommand();
            switch (ITXDBVERSION)
            {
                case "YGR":
                case "AFS":
                case "TST":
                case "UBT":
                case "SXN":
                default:
                    or1.CommandText = "INSERT INTO VAFARBEN(VAFMANDANT, VAFKOLL, VAFART, VAFFARBE, VAFLIEFERSG, VAFBEZ, VAFFFARBE, VAFDESS, VAFCOLORIT, VAFBESCHICH, VAFPKUNDNR, VAFPWERK, VAFPABT, VAFPART, VAFPVAR, VAFPLART, VAFSPERRDAT, VAFKZZOLL2, VAFFARBGRP, VAFMUFAEH, VAFCOFAEH, VAFMINPR1, VAFMINPR2, VAFABVK, VAFSFERTKZ, VAFEAN, VAFPGROE, VAFARTBEZ, VAFZUSTAND, VAFURCODE1, VAFURCODE2, VAFURCODE3, VAFURCODE4, VAFKZDUMCOL, VAFLASCHE, VAFPVARKZ, VAFSTANDARD, VAFEANLASCHE, VAFFILLER, VAFAENDZL, VAFAENDBEN, VAFAENDDAT, VAFNEUBEN, VAFNEUDAT)"
                                + "  VALUES (:VAFMANDANT:,:VAFKOLL:,:VAFART:,:VAFFARBE:,:VAFLIEFERSG:,:VAFBEZ:,:VAFFFARBE:,:VAFDESS:,:VAFCOLORIT:,:VAFBESCHICH:,:VAFPKUNDNR:,:VAFPWERK:,:VAFPABT:,:VAFPART:,:VAFPVAR:,:VAFPLART:,:VAFSPERRDAT:,:VAFKZZOLL2:,:VAFFARBGRP:,:VAFMUFAEH:,:VAFCOFAEH:,:VAFMINPR1:,:VAFMINPR2:,:VAFABVK:,:VAFSFERTKZ:,:VAFEAN:,:VAFPGROE:,:VAFARTBEZ:,:VAFZUSTAND:,:VAFURCODE1:,:VAFURCODE2:,:VAFURCODE3:,:VAFURCODE4:,:VAFKZDUMCOL:,:VAFLASCHE:,:VAFPVARKZ:,:VAFSTANDARD:,:VAFEANLASCHE:,:VAFFILLER:,:VAFAENDZL:,:VAFAENDBEN:,:VAFAENDDAT:,:VAFNEUBEN:,:VAFNEUDAT:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case "FLT":
                    or1.CommandText = "INSERT INTO VAFARBEN ( VAFMANDANT,VAFKOLL,VAFART,VAFFARBE,VAFLIEFERSG,VAFBEZ,VAFFFARBE,VAFDESS,VAFCOLORIT,VAFBESCHICH,VAFPKUNDNR,VAFPWERK,VAFPABT,VAFPART,VAFPVAR,VAFPLART,VAFSPERRDAT,VAFKZZOLL2,VAFFARBGRP,VAFMUFAEH,VAFCOFAEH,VAFMINPR1,VAFMINPR2,VAFABVK,VAFSFERTKZ,VAFEAN,VAFPGROE,VAFARTBEZ,VAFZUSTAND,VAFURCODE1,VAFURCODE2,VAFURCODE3,VAFURCODE4,VAFKZDUMCOL,VAFLASCHE,VAFPVARKZ,VAFSTANDARD,VAFEANLASCHE,VAFFILLER,VAFAENDZL,VAFAENDBEN,VAFAENDDAT,VAFNEUBEN,VAFNEUDAT)"
                    + " VALUES (:VAFMANDANT:,:VAFKOLL:,:VAFART:,:VAFFARBE:,:VAFLIEFERSG:,:VAFBEZ:,:VAFFFARBE:,:VAFDESS:,:VAFCOLORIT:,:VAFBESCHICH:,:VAFPKUNDNR:,:VAFPWERK:,:VAFPABT:,:VAFPART:,:VAFPVAR:,:VAFPLART:,:VAFSPERRDAT:,:VAFKZZOLL2:,:VAFFARBGRP:,:VAFMUFAEH:,:VAFCOFAEH:,:VAFMINPR1:,:VAFMINPR2:,:VAFABVK:,:VAFSFERTKZ:,:VAFEAN:,:VAFPGROE:,:VAFARTBEZ:,:VAFZUSTAND:,:VAFURCODE1:,:VAFURCODE2:,:VAFURCODE3:,:VAFURCODE4:,:VAFKZDUMCOL:,:VAFLASCHE:,:VAFPVARKZ:,:VAFSTANDARD:,:VAFEANLASCHE:,:VAFFILLER:,:VAFAENDZL:,:VAFAENDBEN:,:VAFAENDDAT:,:VAFNEUBEN:,:VAFNEUDAT:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            Connect2Proxy(or1);
        }
        public override string BATCHINSERT(DataRow dwData)
        {
            dwData["VAFNEUBEN"] = app.User;
            dwData["VAFNEUDAT"] = date;
            string value = "";
            switch (app.company)
            {
                default:
                case "SXN":
                case "YGR":
                case "TST":
                    value = "INTO VAFARBEN  "
                        + "VALUES (:VAFMANDANT:,:VAFKOLL:,:VAFART:,:VAFFARBE:,:VAFLIEFERSG:,:VAFBEZ:,:VAFFFARBE:,:VAFDESS:,:VAFCOLORIT:,:VAFBESCHICH:,:VAFPKUNDNR:,:VAFPWERK:,:VAFPABT:,:VAFPART:,:VAFPVAR:,:VAFPLART:,:VAFSPERRDAT:,:VAFKZZOLL2:,:VAFFARBGRP:,:VAFMUFAEH:,:VAFCOFAEH:,:VAFMINPR1:,:VAFMINPR2:,:VAFABVK:,:VAFSFERTKZ:,:VAFEAN:,:VAFPGROE:,:VAFARTBEZ:,:VAFZUSTAND:,:VAFURCODE1:,:VAFURCODE2:,:VAFURCODE3:,:VAFURCODE4:,:VAFKZDUMCOL:,:VAFLASCHE:,:VAFPVARKZ:,:VAFSTANDARD:,:VAFEANLASCHE:,:VAFFILLER:,:VAFAENDZL:,:VAFAENDBEN:,:VAFAENDDAT:,:VAFNEUBEN:,:VAFNEUDAT:)";
                    value = INTEXDBC.InjectData(value, dwData);
                    break;
            }
            return value;
        }
        public DataSet QueryVAFARBEN(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM VAFARBEN WHERE  ROWNUM<2 ";
                    break;
                case 1:
                    SResult = QVAF01(dwData); break;
                case 2: SResult = QVAF02(dwData); break;
                case 3: SResult = QVAF03(dwData); break;
                case 4: SResult = QVAF04(dwData); break;
                case 5: SResult = QVAF05(dwData); break;
                case 6: SResult = QVAF06(dwData); break;
                case 7: SResult = QVAF07(dwData); break;
                case 8: SResult = QVAF08(dwData); break;
                case 9: SResult = QVAF09(dwData); break;
                case -1: SResult = QVAF_1(dwData); break;
                case 99:
                    or1.CommandText = "SELECT * FROM VAFARBEN  WHERE ROWNUM<50";
                    break;
                default:
                    break;
            }
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF_1(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT RTRIM(VAFFARBE) AS KEY,NVL(LMFRGBWERT1||LMFRGBWERT2||LMFRGBWERT3,'000000000') AS RGB,VAAARTST,VAAPRGR,VAAARTGRP,VAAARTWEB,VAABEZ,VAFKOLL,VAFART,VAFFARBE,VAFBEZ,VAFPART,VAFPVAR, VAFFFARBE,VAFDESS,VAFCOLORIT,VAFBESCHICH FROM VAFARBEN "
                + " JOIN VAART ON VAAMANDANT=VAFMANDANT AND VAAKOLL=VAFKOLL AND VAAART=VAFART "
                + " LEFT JOIN LMFKART ON LMFMANDANT=VAFMANDANT AND LMFKARTNR='ALL       '  AND LMFFARBE=VAFFARBE"
                         + " WHERE  VAFMANDANT=:VAFMANDANT:  AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART:"
                             + " ORDER BY 1,2,3";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT VAFKOLL||VAFART||VAFFARBE AS KEY,NVL(LMFRGBWERT1||LMFRGBWERT2||LMFRGBWERT3,'000000000') AS RGB, P.* "
                + " FROM VAFARBEN P  LEFT JOIN LMFKART ON LMFMANDANT=VAFMANDANT AND LMFKARTNR='ALL       '  AND LMFFARBE=VAFFARBE"
                + " WHERE  VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF01X(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT P.* FROM VAFARBEN P  WHERE  VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT  VAFKOLL||VAFART||VAFFARBE AS KEY, VAAARTST,VAAPRGR,VAAARTGRP,VAAARTWEB,VAABEZ,VAAFILLER AS COMP,TRIM(NVL(WABIND,'')) AS SUP,P.* FROM VAFARBEN P "
                + " JOIN VAART ON VAAMANDANT=VAFMANDANT AND VAAKOLL=VAFKOLL AND VAAART=VAFART"
                + " LEFT JOIN WASTAMM ON WAMANDANT=VAAMANDANT AND  WADART =VAADART AND WADVAR=VAADVAR"
                + " WHERE  VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART: AND VAFFARBE=:VAFFARBE:"
                + " ORDER BY VAFART,VAFFARBE "
                ;
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF03(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT VAFKOLL||VAFART||VAFFARBE AS KEY,A.* FROM VAFARBEN A JOIN VKPOS V ON A.VAFMANDANT=V.VKPMANDANT AND A.VAFKOLL=V.VKPKOLL AND A.VAFART=V.VKPART AND A.VAFFARBE=V.VKPFARBE"
                       + " WHERE VKPMANDANT=:VKPMANDANT: AND VKPSA='  ' AND VKPAUFKRS=:VKPAUFKRS: AND VKPAUFLFD=:VKPAUFLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF04(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT VAFKOLL||VAFART||VAFFARBE AS KEY,P.* FROM VAFARBEN P WHERE  VAFMANDANT=:VAFMANDANT: AND VAFART =:VAFART: AND VAFFARBE=:VAFFARBE:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF05(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT VAFKOLL||VAFART||VAFFARBE AS KEY,WAGFKZ,NVL(LMFRGBWERT1||LMFRGBWERT2||LMFRGBWERT3,'000000000') AS RGB,VAAARTST,VAAPRGR,VAAARTGRP,VAAARTWEB,VAABEZ,WAFBEZ,WAFGRPBEZ,WAFDDIM,M.* FROM VAFARBEN M "
                          + " JOIN VAART P ON VAAMANDANT=VAFMANDANT AND VAAKOLL=VAFKOLL AND VAAART=VAFART  "
                          + " LEFT JOIN WASTAMM ON WAMANDANT=VAAMANDANT AND WADART=VAADART AND WADVAR=VAADVAR "
                          + " LEFT JOIN LMFKART ON LMFMANDANT = VAFMANDANT AND LMFKARTNR = 'ALL       ' AND  LMFFARBE = VAFFARBE"
                               + " LEFT JOIN WAFARBEN ON WAFMANDANT=VAFMANDANT AND WAFART=VAFPART AND WAFVAR=VAFPVAR AND (WAFZUART='C' OR WAFZUART='F') AND VAFFFARBE=WAFZUSATZ"
                          + " WHERE  VAFMANDANT=:VAFMANDANT:"
                          + "   AND VAFKOLL LIKE '" + dwData["VAFKOLL"].ToString().Trim() + "%' AND VAFART LIKE '"
                          + dwData["VAFART"].ToString().Trim() + "%' AND VAFFARBE  LIKE '"
                          + dwData["VAFFARBE"].ToString().Trim() + "%'"
                          + " AND VAFBEZ LIKE '" + dwData["VAFBEZ"].ToString().Trim() + "%'"
                          + " ORDER BY 1,2,3,4,5,6,7,8,9";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF06(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT  VAFKOLL||VAFART||VAFFARBE AS KEY FROM VAFARBEN P  WHERE  VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART: AND VAFFARBE=:VAFFARBE:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF07(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT VAFKOLL||VAFART||VAFFARBE AS KEY,TRIM(WAART) AS VAAART,WABEZ AS DES,WAFBRTU*0.1 AS TOTWIDTH, WAFBRTL*0.1 AS VALWIDTH,WAFGRQM,WAFGRLFD,TRIM(WAFBEM) AS YARN, "
                   + " WABIND,WALOHNA,B.LSNAME1 AS SUPP,   (SELECT AGG(DECODE(A,'XXX','',A)||B) FROM (SELECT DISTINCT C,A,MAX(B)OVER(PARTITION BY C,A) AS B FROM ( "
                   + "  SELECT DISTINCT C,A,STRAGG(B)OVER(PARTITION BY C,A ORDER BY A,D DESC) B FROM (SELECT DISTINCT TRIM(SUBSTR(STUELISAPD,15,20)) AS C,    "
                   + "  DECODE(TRIM(SUBSTR(STUELIDATEN,55,2)),'R','XXX','FL','FACE:','GS','GROUND:') AS A, TO_NUMBER(SUBSTR(STUELIDATEN,1,4))*0.1||'%'||TRIM(STUELISASB) AS B , SUBSTR(STUELIDATEN,1,4) AS D   "
                   + "  FROM STUELI WHERE SUBSTR(STUELIDATEN,55,2) IN ('R ','FL','GS')    )))WHERE C=TRIM(A.WAART)) AS COMP ,WANEUD,  (SELECT AGG(TRIM(TXTKTEXT)) AS REMARK FROM TXTIND C,TXTKON D "
                   + " WHERE C.TXTIMANDANT = D.TXTKMANDANT AND C.TXTIPIND = D.TXTKPIND AND TXTITXTART = 'WET' "
                   + " AND TRIM(SUBSTR(TXTISIND,15,12)) =TRIM(A.WAART)) AS REMARK, "
                   + " (SELECT DISTINCT STRAGG(DISTINCT TRIM(F.VAFDESS)) "
                   + "  OVER(PARTITION BY V.VAAART)||DECODE(TRIM(V.VAAKURZBEZ),'.','',','||TRIM(V.VAAKURZBEZ)) "
                   + " FROM VAART V,VAFARBEN F "
                   + "  WHERE V.VAAMANDANT = F.VAFMANDANT AND V.VAAKOLL = F.VAFKOLL "
                   + "  AND V.VAAART = F.VAFART AND A.WAART=V.VAADART  )  AS DESIGN "
                   + " FROM WASTAMM A,LIEFDAT B "
                   + " WHERE A.WAMANDANT = B.LSMANDANT AND A.WALIEFNR = B.LSLIEFNR "
                   + " AND WAART LIKE '" + dwData["VAFART"].ToString().Trim() + "%' AND A.WALOHNA LIKE '%" + dwData["VAFBEZ"].ToString().Trim() + "%' "
                   + " AND A.WAART IN ( SELECT V.VAADART FROM VAART V,VAFARBEN F "
                   + "  WHERE V.VAAMANDANT = F.VAFMANDANT AND V.VAAKOLL = F.VAFKOLL "
                   + "  AND V.VAAART = F.VAFART "
                   + "  AND (TRIM(V.VAAKURZBEZ) = '" + dwData["VAFDESS"].ToString().Trim() + "' OR TRIM(F.VAFDESS) = '" + dwData["VAFDESS"].ToString().Trim()
                   + "' OR '" + dwData["VAFDESS"].ToString().Trim() + "'='XXXXXXXXXX')) "
                   + " ORDER BY 1 ";
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF08(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT RTRIM(VAFFARBE) AS KEY,VAAARTST,VAAPRGR,VAAARTGRP,VAAARTWEB,VAABEZ,VAFKOLL,VAFART,VAFFARBE,VAFBEZ,VAFPART,VAFPVAR, VAFFFARBE,VAFDESS,VAFCOLORIT,VAFBESCHICH FROM VAFARBEN  JOIN VAART ON VAAMANDANT=VAFMANDANT AND VAAKOLL=VAFKOLL AND VAAART=VAFART "
              + " WHERE  VAFMANDANT=:VAFMANDANT:  AND VAFPART=:VAFPART: AND VAFPVAR =:VAFPVAR: AND VAFFFARBE=:VAFFFARBE:"
                  + " ORDER BY 1,2,3";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF09(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT  DISTINCT VAFKOLL,VAFART,VAFFARBE,MAX(DECODE(TXTKATR,1,SUBSTR(TXTKTEXT,9,4),'')) AS T1APPDT,MAX(DECODE(TXTKATR,2,SUBSTR(TXTKTEXT,9,4),'')) AS T2APPDT,MAX(DECODE(TXTKATR,3,SUBSTR(TXTKTEXT,9,4),'')) AS T3APPDT"
                + ",MAX(DECODE(TXTKATR,4,SUBSTR(TXTKTEXT,9,4),'')) AS T4APPDT"
                + ",MAX(DECODE(TXTKATR,5,SUBSTR(TXTKTEXT,9,4),'')) AS T5APPDT"
                + ",MAX(DECODE(TXTKATR,6,SUBSTR(TXTKTEXT,9,4),'')) AS T6APPDT"
                + ",MAX(DECODE(TXTKATR,7,SUBSTR(TXTKTEXT,9,4),'')) AS T7APPDT"
                + ",MAX(DECODE(TXTKATR,8,SUBSTR(TXTKTEXT,9,4),'')) AS T8APPDT"
                + ",MAX(DECODE(TXTKATR,9,SUBSTR(TXTKTEXT,9,4),'')) AS T9APPDT"
                      + " FROM VAFARBEN LEFT JOIN  TXTIND ON  VAFMANDANT=TXTIMANDANT  AND   TXTITXTART='VAF' AND TXTISIND =VAFKOLL||VAFART||VAFFARBE||'                     '"
                      + " LEFT JOIN   TXTKON   ON TXTIMANDANT=TXTKMANDANT and TXTIPIND=TXTKPIND AND   TXTKFILLER='90'  AND TXTKTEXT<>'                                                                                '"
                      + " WHERE  VAFMANDANT=:VAFMANDANT:  AND VAFKOLL LIKE '" + dwData["VAFKOLL"].ToString().Trim() + "%' AND VAFART LIKE '"
                      + dwData["VAFART"].ToString().Trim() + "%' "
                      + " AND VAFFARBE LIKE '" + dwData["VAFFARBE"].ToString() + "%'"
                      + " GROUP BY VAFKOLL,VAFART,VAFFARBE"
                      + " ORDER BY VAFART,VAFFARBE";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF11(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT  DISTINCT VAFKOLL,VAFART,VAFFARBE,MAX(DECODE(TXTKATR,1,SUBSTR(TXTKTEXT,9,4),'')) AS T1APPDT,MAX(DECODE(TXTKATR,2,SUBSTR(TXTKTEXT,9,4),'')) AS T2APPDT,MAX(DECODE(TXTKATR,3,SUBSTR(TXTKTEXT,9,4),'')) AS T3APPDT"
                + ",MAX(DECODE(TXTKATR,4,SUBSTR(TXTKTEXT,9,4),'')) AS T4APPDT"
                + ",MAX(DECODE(TXTKATR,5,SUBSTR(TXTKTEXT,9,4),'')) AS T5APPDT"
                + ",MAX(DECODE(TXTKATR,6,SUBSTR(TXTKTEXT,9,4),'')) AS T6APPDT"
                + ",MAX(DECODE(TXTKATR,7,SUBSTR(TXTKTEXT,9,4),'')) AS T7APPDT"
                + ",MAX(DECODE(TXTKATR,8,SUBSTR(TXTKTEXT,9,4),'')) AS T8APPDT"
                + ",MAX(DECODE(TXTKATR,9,SUBSTR(TXTKTEXT,9,4),'')) AS T9APPDT"
                      + " FROM VAFARBEN LEFT JOIN  TXTIND ON  VAFMANDANT=TXTIMANDANT  AND   TXTITXTART='V00' AND TXTISIND =VAFKOLL||VAFART||VAFFARBE||'                     '"
                      + " LEFT JOIN   TXTKON   ON TXTIMANDANT=TXTKMANDANT and TXTIPIND=TXTKPIND AND   TXTKFILLER='90'  AND TXTKTEXT<>'                                                                                '"
                      + " WHERE  VAFMANDANT=:VAFMANDANT:  AND VAFKOLL LIKE '" + dwData["VAFKOLL"].ToString().Trim() + "%' AND VAFART LIKE '"
                      + dwData["VAFART"].ToString().Trim() + "%' "
                      + " AND VAFFARBE LIKE '" + dwData["VAFFARBE"].ToString() + "%'"
                      + " GROUP BY VAFKOLL,VAFART,VAFFARBE"
                      + " ORDER BY VAFART,VAFFARBE";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF10(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT RTRIM(VAFFARBE) AS KEY,LSLIEFNA,VAAARTST,VAAPRGR,VAAARTGRP,VAAARTWEB,VAABEZ,VAFKOLL,VAFART,VAFFARBE,VAFBEZ,VAFPART,VAFPVAR, VAFFFARBE,VAFDESS,VAFCOLORIT,VAFBESCHICH FROM VAFARBEN "
                + " JOIN VAART ON VAAMANDANT=VAFMANDANT AND VAAKOLL=VAFKOLL AND VAAART=VAFART "
                + " LEFT JOIN WASTAMM ON WAMANDANT=VAAMANDANT AND WAART=VAADART  "
                + " LEFT JOIN LIEFDAT ON LSMANDANT=WAMANDANT AND LSLIEFNR=WALIEFNR"
                 + " WHERE  VAFMANDANT=:VAFMANDANT:  AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART:"
                + " ORDER BY 1,2,3";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }

        public DataSet QVAF10RED(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM COLOR_REC "
                + " WHERE DAT>= " + dwData["VAFAENDDAT"] + " AND DAT <= " + dwData["VAFNEUDAT"] + " AND (OCOLOR " + dwData["VAFART"] + " OR NCOLOR " + dwData["VAFART"] + ")  "
                + " ORDER BY REC_ID";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF12(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = " SELECT * FROM VAFARBEN WHERE VAFART =:VAFART:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QVAF13(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT VKPAUFKRS,VKPAUFLFD,VKPAUFOS,VAFKOLL||VAFART||VAFFARBE AS KEY,A.* "
            + " FROM VAFARBEN A JOIN VKPOS V ON A.VAFMANDANT=V.VKPMANDANT AND A.VAFKOLL=V.VKPKOLL AND A.VAFART=V.VKPART AND A.VAFFARBE=V.VKPFARBE"
             + " JOIN VKKOPF ON VKKAUFKRS=VKPAUFKRS AND VKKAUFLFD=VKPAUFLFD AND VKPSA='  ' AND VKKMANDANT=VKPMANDANT"
            + " WHERE VKKMANDANT=:VKKMANDANT: AND VKPSA='  ' AND VKKAUFKRS=:VKKAUFKRS: AND VKKAUFLFD=:VKKAUFLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public void DeleteVAFARBEN(DataRow dwData, int option = 1)
        {

            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    DVF01(dwData);
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
        public void DVF00(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE FROM VAFARBEN  WHERE  VAFMANDANT=:VAFMANDANT:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }

        public void DVF01(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();

            or1.CommandText = "DELETE FROM VAFARBEN  "
    + " WHERE  VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART =:VAFART: AND VAFFARBE=:VAFFARBE:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            Connect2Proxy(or1);
        }

        public DataSet QueryVAFARBEN(string client, string coll, string art, string color)
        {
            DataSet Return;
            DataSet Result = new DataSet();
            OracleCommand or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM VAFARBEN  WHERE VAFMANDANT=:VAFMANDANT  AND VAFKOLL=:VAFKOLL AND VAFART =:VAFART AND VAFFARBE=:VAFFARBE"
            ;
            or1.Parameters.Add("VAFMANDANT", OracleType.NVarChar).Value = client;
            or1.Parameters.Add("VAFKOLL", OracleType.NVarChar).Value = coll;
            or1.Parameters.Add("VAFART", OracleType.NVarChar).Value = art;
            or1.Parameters.Add("VAFFARBE", OracleType.NVarChar).Value = color;
            Result = Connect2Proxy(or1);
            if (Result.Tables.Count > 0)
                Result.Tables[0].TableName = "VAFARBEN";
            Return = Result;
            return Return;
        }

        public void UpdateVAFARBEN(DataRow dwData, string ITXDBVERSION = "50.24", int option = 1)
        {
            string USERID = app.User;
            string DAT = INTEXDBC.GetDBDATE();
            if (option == 0)
            {
                switch (app.company)
                {
                    case "FLT":
                        option = 4;
                        break;
                    default:
                    case "YGR":
                    case "AFS":
                    case "TST":
                    case "UBT":
                    case "SXN":
                        option = 3;
                        break;
                    case "JLT":
                        option = 1;
                        break;
                }
            }
            if (dwData != null)
            {
                dwData["VAFAENDBEN"] = app.User;
                dwData["VAFAENDDAT"] = date;
            }
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    #region====Command====

                    or1.CommandText = "UPDATE VAFARBEN SET "
                        + "VAFMANDANT=:VAFMANDANT:,"
                        + "VAFKOLL=:VAFKOLL:,"
                        + "VAFART=:VAFART:,"
                        + "VAFFARBE=:VAFFARBE:,"
                        + "VAFLIEFERSG=:VAFLIEFERSG:,"
                        + "VAFBEZ=:VAFBEZ:,"
                        + "VAFFFARBE=:VAFFFARBE:,"
                        + "VAFDESS=:VAFDESS:,"
                        + "VAFCOLORIT=:VAFCOLORIT:,"
                        + "VAFBESCHICH=:VAFBESCHICH:,"
                        + "VAFPKUNDNR=:VAFPKUNDNR:,"
                        + "VAFPWERK=:VAFPWERK:,"
                        + "VAFPABT=:VAFPABT:,"
                        + "VAFPART=:VAFPART:,"
                        + "VAFPVAR=:VAFPVAR:,"
                        + "VAFPLART=:VAFPLART:,"
                        + "VAFSPERRDAT=:VAFSPERRDAT:,"
                        + "VAFKZZOLL2=:VAFKZZOLL2:,"
                        + "VAFFARBGRP=:VAFFARBGRP:,"
                        + "VAFMUFAEH=:VAFMUFAEH:,"
                        + "VAFCOFAEH=:VAFCOFAEH:,"
                        + "VAFMINPR1=:VAFMINPR1:,"
                        + "VAFMINPR2=:VAFMINPR2:,"
                        + "VAFABVK=:VAFABVK:,"
                        + "VAFSFERTKZ=:VAFSFERTKZ:,"
                        + "VAFEAN=:VAFEAN:,"
                        + "VAFPGROE=:VAFPGROE:,"
                        + "VAFARTBEZ=:VAFARTBEZ:,"
                        + "VAFZUSTAND=:VAFZUSTAND:,"
                        + "VAFURCODE1=:VAFURCODE1:,"
                        + "VAFURCODE2=:VAFURCODE2:,"
                        + "VAFURCODE3=:VAFURCODE3:,"
                        + "VAFURCODE4=:VAFURCODE4:,"
                        + "VAFKZDUMCOL=:VAFKZDUMCOL:,"
                        + "VAFLASCHE=:VAFLASCHE:,"
                        + "VAFPVARKZ=:VAFPVARKZ:,"
                        + "VAFSTANDARD=:VAFSTANDARD:,"
                        + "VAFEANLASCHE=:VAFEANLASCHE:,"
                        + "VAFFILLER=:VAFFILLER:,"
                        + "VAFAENDZL=:VAFAENDZL:,"
                        + "VAFAENDBEN=:VAFAENDBEN:,"
                        + "VAFAENDDAT=:VAFAENDDAT:,"
                        + "VAFNEUBEN=:VAFNEUBEN:,"
                        + "VAFNEUDAT=:VAFNEUDAT:"
                        + " WHERE  "
                        + "  VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART=:VAFART: AND VAFFARBE=:VAFFARBE:";
                    #endregion

                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 2:
                    #region====Parameters====
                    or1.CommandText = "UPDATE VAFARBEN SET VAFARTBEZ=:VAFARTBEZ:,VAFAENDBEN=:VAFAENDBEN:,VAFAENDDAT=:VAFAENDDAT: WHERE    VAFMANDANT=:VAFMANDANT:  AND VAFART=:VAFART:  ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    #endregion
                    break;
                case 3:
                    or1.CommandText = "UPDATE VAFARBEN SET VAFMANDANT=:VAFMANDANT:,VAFKOLL=:VAFKOLL:,VAFART=:VAFART:,VAFFARBE=:VAFFARBE:,VAFLIEFERSG=:VAFLIEFERSG:,VAFBEZ=:VAFBEZ:,VAFFFARBE=:VAFFFARBE:,VAFDESS=:VAFDESS:,VAFCOLORIT=:VAFCOLORIT:,VAFBESCHICH=:VAFBESCHICH:,VAFPKUNDNR=:VAFPKUNDNR:,VAFPWERK=:VAFPWERK:,VAFPABT=:VAFPABT:,VAFPART=:VAFPART:,VAFPVAR=:VAFPVAR:,VAFPLART=:VAFPLART:,VAFSPERRDAT=:VAFSPERRDAT:,VAFKZZOLL2=:VAFKZZOLL2:,VAFFARBGRP=:VAFFARBGRP:,VAFMUFAEH=:VAFMUFAEH:,VAFCOFAEH=:VAFCOFAEH:,VAFMINPR1=:VAFMINPR1:,VAFMINPR2=:VAFMINPR2:,VAFABVK=:VAFABVK:,VAFSFERTKZ=:VAFSFERTKZ:,VAFEAN=:VAFEAN:,VAFPGROE=:VAFPGROE:,VAFARTBEZ=:VAFARTBEZ:,VAFZUSTAND=:VAFZUSTAND:,VAFURCODE1=:VAFURCODE1:,VAFURCODE2=:VAFURCODE2:,VAFURCODE3=:VAFURCODE3:,VAFURCODE4=:VAFURCODE4:,VAFKZDUMCOL=:VAFKZDUMCOL:,VAFLASCHE=:VAFLASCHE:,VAFPVARKZ=:VAFPVARKZ:,VAFSTANDARD=:VAFSTANDARD:,VAFEANLASCHE=:VAFEANLASCHE:,VAFFILLER=:VAFFILLER:,VAFAENDZL=:VAFAENDZL:,VAFAENDBEN=:VAFAENDBEN:,VAFAENDDAT=:VAFAENDDAT:"
                     + " WHERE VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART=:VAFART: AND VAFFARBE=:VAFFARBE:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 4:
                    or1.CommandText = "UPDATE VAFARBEN SET VAFMANDANT=:VAFMANDANT:,VAFKOLL=:VAFKOLL:,VAFART=:VAFART:,VAFFARBE=:VAFFARBE:,VAFLIEFERSG=:VAFLIEFERSG:,VAFBEZ=:VAFBEZ:,VAFFFARBE=:VAFFFARBE:,VAFDESS=:VAFDESS:,VAFCOLORIT=:VAFCOLORIT:,VAFBESCHICH=:VAFBESCHICH:,VAFPKUNDNR=:VAFPKUNDNR:,VAFPWERK=:VAFPWERK:,VAFPABT=:VAFPABT:,VAFPART=:VAFPART:,VAFPVAR=:VAFPVAR:,VAFPLART=:VAFPLART:,VAFSPERRDAT=:VAFSPERRDAT:,VAFKZZOLL2=:VAFKZZOLL2:,VAFFARBGRP=:VAFFARBGRP:,VAFMUFAEH=:VAFMUFAEH:,VAFCOFAEH=:VAFCOFAEH:,VAFMINPR1=:VAFMINPR1:,VAFMINPR2=:VAFMINPR2:,VAFABVK=:VAFABVK:,VAFSFERTKZ=:VAFSFERTKZ:,VAFEAN=:VAFEAN:,VAFPGROE=:VAFPGROE:,VAFARTBEZ=:VAFARTBEZ:,VAFZUSTAND=:VAFZUSTAND:,VAFURCODE1=:VAFURCODE1:,VAFURCODE2=:VAFURCODE2:,VAFURCODE3=:VAFURCODE3:,VAFURCODE4=:VAFURCODE4:,VAFKZDUMCOL=:VAFKZDUMCOL:,VAFLASCHE=:VAFLASCHE:,VAFPVARKZ=:VAFPVARKZ:,VAFSTANDARD=:VAFSTANDARD:,VAFEANLASCHE=:VAFEANLASCHE:,VAFFILLER=:VAFFILLER:,VAFAENDZL=:VAFAENDZL:,VAFAENDBEN=:VAFAENDBEN:,VAFAENDDAT=:VAFAENDDAT:,VAFNEUBEN=:VAFNEUBEN:,VAFNEUDAT=:VAFNEUDAT:"
                      + " WHERE VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART=:VAFART: AND VAFFARBE=:VAFFARBE:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 5:
                    #region====Parameters====
                    or1.CommandText = "UPDATE VAFARBEN SET VAFFARBE=:VAFFARBE:,VAFFFARBE=:VAFFARBE:,VAFAENDBEN ='" + USERID + "',VAFAENDDAT='" + DAT + "'  "
                     + " WHERE VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART=:VAFART: AND VAFFARBE=:VAFFILLER:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    #endregion
                    break;
                case 6:
                    #region====Parameters====
                    or1.CommandText = "UPDATE VAFARBEN SET VAFBEZ=:VAFBEZ:,VAFFARBGRP=:VAFFARBGRP:,VAFAENDBEN=:VAFAENDBEN:,VAFAENDDAT=:VAFAENDDAT: "
                                             + " WHERE VAFMANDANT=:VAFMANDANT: AND VAFKOLL=:VAFKOLL: AND VAFART=:VAFART: AND VAFFARBE=:VAFFARBE:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    #endregion
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
    }
}
